package geppetto.phraseHMM.phraseExtraction.phraseAccepter;

import geppetto.phraseHMM.phraseExtraction.extractedphrase.ExtractedPhrasePair;

import java.util.ArrayList;

public class CompositePhraseAccepter extends AbstractPhraseAccepter {

	ArrayList<AbstractPhraseAccepter> list;

	public CompositePhraseAccepter() {
		list = new ArrayList<AbstractPhraseAccepter>();
	}

	public void add(AbstractPhraseAccepter accepter) {
		list.add(accepter);
	}

	/*public boolean acceptPhrase(int sentenceNumber, byte sentenceSource,
			int[] foreingSentence, int[] sourceSentence, int sourceStartPos,
			int sourceEndPos, int foreignStartPos, int foreignEndPos,
			double score) {
		for (AbstractPhraseAccepter accepter : list) {
			if (!accepter.acceptPhrase(sentenceNumber, sentenceSource,
					foreingSentence, sourceSentence, sourceStartPos,
					sourceEndPos, foreignStartPos, foreignEndPos, score)) {
				return false;
			}
		}
		return true;
	}*/

	@Override
	public boolean acceptPhrase(ExtractedPhrasePair epp) {
		for (AbstractPhraseAccepter accepter : list) {
			if (!accepter.acceptPhrase(epp)) {
				return false;
			}
		}
		return true;
	}

}